package com.mikeorth.view
{
	import flash.events.MouseEvent;
	
	import mx.containers.TitleWindow;

	/**
	 * TitleWindow that can disable dragging when used as a popup.
	 */ 
	public class UndraggableTitleWindow extends TitleWindow
	{
		public function UndraggableTitleWindow()
		{
			super();
		}
		
		/**
		 * Flag for enabled dragging the TitleWindow.
		 *
		 * @default false 
		 */		
		public var dragEnabled:Boolean = false;
		 
		/**
		 * Overrides the Panel function that handles dragging when the container
		 * is used as a PopUp. The function super.startDragging() is only called when
		 * dragging is enabled.
		 */  		
		override protected function startDragging(event:MouseEvent):void
		{
			if (!dragEnabled)
				event.preventDefault();
			else
				super.startDragging(event);
		}
		
	}
}